package com.nbsaas.boot.quartz.rest.convert;

import com.nbsaas.boot.quartz.data.entity.SchedulingTaskRecord;
import com.nbsaas.boot.quartz.api.domain.request.SchedulingTaskRecordRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.quartz.data.entity.SchedulingTask;

/**
* 定时任务记录请求对象转换成实体对象
*/

public class SchedulingTaskRecordEntityConvert  implements Converter<SchedulingTaskRecord, SchedulingTaskRecordRequest> {

    @Override
    public SchedulingTaskRecord convert(SchedulingTaskRecordRequest source) {
        SchedulingTaskRecord result = new SchedulingTaskRecord();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getSchedulingTask()!=null){
                    SchedulingTask schedulingTask =new SchedulingTask();
                    schedulingTask.setId(source.getSchedulingTask());
                    result.setSchedulingTask(schedulingTask);
                    }
        return result;
    }
}

